package com.lmf.cloud.controller;

import com.lmf.cloud.entity.TOrder;
import com.lmf.cloud.resp.ResultData;
import com.lmf.cloud.service.TOrderService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author LiuMingFu
 * @since 2024-08-01
 */
@RestController
@RequestMapping("/t-order")
public class TOrderController {


    @Resource
    private TOrderService tOrderService;


    /**
     * 获取所有订单信息
     *
     * @return
     * @author LiuMingFu
     * @date 2024/8/1
     */
    @RequestMapping("/getAllOrder")
    public ResultData<List<TOrder>> getAllOrder(Long userId) {
        return tOrderService.getAllOrder(userId);
    }

    /**
     * 创建订单
     *
     * @param
     * @return
     * @author LiuMingFu
     * @date 2024/8/1
     */
    @PostMapping("/createOrder")
    public ResultData<Boolean> createOrder(@RequestBody TOrder tOrder) {
        return tOrderService.createOrder(tOrder);
    }

}
